//前端非空验证（标签ID，提示语）
function nonEmpty(input, tips) {
    var inputval = $("#" + input).val();
    if (!inputval) {
        layer.tips('请输入'+tips+'!', '#' + input, {tips: [2, '#CC3333']});
        return false;
    }
    return true;
}

//密码验证
function pwdCheck(input, tips){
    if (nonEmpty(input, tips)) {
        var password = $("#password").val();
        var password2 = $("#password2").val();
        if (password != password2) {
            layer.tips('密码不一致！', '#password2', {tips: [2, '#CC3333']});
        }
    }
}



//增加内部工作人员
function changeWorkPwd() {
    var password = $("#password").val();
    var password2 = $("#password2").val();
    if (password != password2) {
        alert("密码不一致，请重新输入！！");
        return;
    };

    $.ajax({
        url : "manageWork/changeWorkPwd.action",
        data : $('#form-admin-add').serialize(),
        type : "post",
        dataType : "text",
        success : function (res) {
            if (res == "success") {
                layer.msg("修改成功！！", {icon: 6, time: 1000}, function () {
                    layer.closeAll(layer.index);
                    window.parent.location.reload()
                });
            } else if (res == "error") {
                layer.msg("修改失败！！", {icon: 6, time: 1000}, function () {
                    layer.closeAll(layer.index);
                    window.parent.location.reload()
                });
            }
        }
    });

}

